<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>作业8</title>
</head>
<body>
<script>
  var str="";
  for (let i = 0; i < 4; i++) {
      for (let j = 0; j < 4 - i - 1; j++) {
          str+=" ";
      }
      for (let j = 0; j <=i; j++) {
          str+="*";
      }
      str+="\n";
  }
  console.log(str);

  var str1="";
  for (let i = 0; i < 4; i++) {
      for (let j = 0; j < 4 - i - 1; j++) {
          str1+=" ";
      }
      for (let j = 0; j <(2*i)+1; j++) {
          str1+="*";
      }
      for (let j = 0; j < 4 - i - 1; j++) {
          str1+=" ";
      }
      str1+="\n";
  }
  console.log(str1);
</script>
</body>
</html>